

-- Namespace
	local _,mod = ...


-- Health
	local function health(nfframe,self)
		local min = self:GetValue()
		local _,max = self:GetMinMaxValues()
		nfframe:Update('health',min,max)
	end
	
	mod:event('hpbar','OnShow',health)
	mod:event('hpbar','OnValueChanged',health)


-- Casting
	mod:event('castbar','OnShow',function(nfframe,self)
		local channel
		local name,_,_,icon,startT,endT,_,_,interrupt = UnitCastingInfo('target')
		if not name then
			name,_,_,icon,startT,endT,_,_,interrupt = UnitChannelInfo('target')
			if name then
				channel = true
			else
				nfframe:Update('casting',nil)
				return
			end
		end
		
		startT = startT * .001
		endT = endT * .001
		
		nfframe:Update('casting',name,icon,startT,endT,interrupt,channel)
	end)
	
	mod:event('castbar','OnHide',function(nfframe,self)
		nfframe:Update('casting',nil)
	end)
